package com.baizhi.controller;

import com.baizhi.entity.OrderDetail;
import com.baizhi.service.OrderMasterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @author yystart
 * @create 2019-10-04 23:12
 */
@RestController
@RequestMapping("/order")
public class OrderController {

    @Autowired
    private OrderMasterService service;

    @PostMapping("/insert")
    public Map insert(@RequestBody Map dataMap){
        return service.insert(dataMap);
    }

    @RequestMapping("/selectMastersByPage")
    public Map selectMastersByPage(int page,int limit){
        return service.selectMastersByPage(page,limit);
    }

    @RequestMapping("/updateStatus")
    public Map updateStatus(String id){
        return service.updateStatus(id);
    }

    @RequestMapping("/delete")
    public Map delete(String id){
        return service.delete(id);
    }

    @RequestMapping("/selectDetailsByMasterId")
    public List<OrderDetail> selectDetailsByMasterId(String orderId){
        return service.selectDetailsByMasterId(orderId);
    }

}
